Problem Note 62844: The LENGTHN function returns incorrect results when used within %SYSFUNC in SAS® 9.4M5 (TS1M5)
The LENGTHN function returns incorrect results when you use it within %SYSFUNC in the fifth maintenance release of SAS 9.4 (TS1M5). The function should return a length of 0 if the value of the argument is blank. However, a length greater than 0 is being returned. This problem does not occur when you use the LENGTHN function in the DATA step.
An example of the incorrect behavior is shown in the example SAS® log output below. The LENGTHN function incorrectly returns a value of 2 when used within %SYSFUNC.
92 %let x=%sysfunc(lengthn(%str( )));
93 %put &=x;
X=2
94
95 data _null_;
96 x = lengthn(" ");
97 put x=;
98 run;
x=0
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.00 seconds
To circumvent the problem, use CALL SYMPUTX to create a macro variable instead of a %LET statement. For example:
data _null_;
call symputx('x',lengthn(" "));
run;
This issue was fixed in SAS 9.4, Rev. 940_18w30.
Operating System and Release Information
SAS System | Base SAS | Linux for x64 | 9.4 TS1M5 | 9.4 TS1M5 |
HP-UX IPF | 9.4 TS1M5 | 9.4 TS1M5 |
64-bit Enabled Solaris | 9.4 TS1M5 | 9.4 TS1M5 |
64-bit Enabled AIX | 9.4 TS1M5 | 9.4 TS1M5 |
Windows 7 Ultimate x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Windows 7 Ultimate 32 bit | 9.4 TS1M5 | 9.4 TS1M5 |
Windows 7 Enterprise x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows Server 2016 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows Server 2012 Std | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows Server 2012 R2 Std | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows Server 2012 R2 Datacenter | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows Server 2012 Datacenter | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows Server 2008 for x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows Server 2008 R2 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows Server 2008 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows 10 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows 8.1 Pro x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows 8.1 Pro 32-bit | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows 8.1 Enterprise x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows 8.1 Enterprise 32-bit | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows 8 Pro x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows 8 Pro 32-bit | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows 8 Enterprise x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft Windows 8 Enterprise 32-bit | 9.4 TS1M5 | 9.4 TS1M5 |
Microsoft® Windows® for x64 | 9.4 TS1M5 | 9.4 TS1M5 |
z/OS 64-bit | 9.4 TS1M5 | 9.4 TS1M5 |
Solaris for x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Windows 7 Professional x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Windows 7 Professional 32 bit | 9.4 TS1M5 | 9.4 TS1M5 |
Windows 7 Home Premium x64 | 9.4 TS1M5 | 9.4 TS1M5 |
Windows 7 Home Premium 32 bit | 9.4 TS1M5 | 9.4 TS1M5 |
z/OS | 9.4 TS1M5 | 9.4 TS1M5 |
Windows 7 Enterprise 32 bit | 9.4 TS1M5 | 9.4 TS1M5 |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
The LENGTHN function returns incorrect results when used within %SYSFUNC in SAS 9.4M5. The function should return a length of 0 if the value of the argument is blank. A length greater than 0 is being returned instead.
Type: | Problem Note |
Priority: | high |
Date Modified: | 2018-08-30 15:59:39 |
Date Created: | 2018-08-30 11:13:33 |